using System;
using System.Collections.Generic;

namespace LannyPractiseCode.Shu
{
    public class ArrBinaryTree
    {
        private int[] arrs;
        public ArrBinaryTree(int[] arr)
        {
            this.arrs=arr;
        }
        public void PreOrder(int index)
        {
            if(arrs==null  || arrs.Length==0)
                System.Console.WriteLine("数组为空，不能按照二叉树的前序遍历");
            //输出当前这个元素
            System.Console.WriteLine(arrs[index]);
            if(index *2+1 <arrs.Length)
            {
                PreOrder(2*index+1);
            }

            if(index *2+2 <arrs.Length)
            {
                PreOrder(2*index+2);
            }

        }
    }
}